package main

import (
	"flag"
	"fmt"
	"sort"
	"time"
)

func main() {
	months := [13]string{1: "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}

	Q2 := months[4:7]
	summer := months[6:9]
	fmt.Println(Q2)          // ["April" "May" "June"]
	fmt.Println(summer[0:5]) // ["June" "July" "August"]
	s := "January"
	s1 := s[2:3]
	fmt.Println(s1)
	// fmt.Println(s1[:5])
	for i, v := range summer {
		fmt.Println(i, v)
	}

	var runes []rune
	for _, r := range "Hello, 世界" {
		runes = append(runes, r)
	}
	fmt.Printf("%q\n", runes)
	b := make([]int, 2, 5)
	b[0] = 1
	fmt.Println(b, b[0:5])
	change(b)
	fmt.Println(b, b[0])
	flag.Duration()
}

func change(s []int) {
	s[1] = 2
	s = append(s, 3)
	fmt.Println(s[0:5])
	ages := make(map[string]int)
	ages["alice"] = 31
	ages["charlie"] = 34

	fmt.Println(ages)
	ages1 := map[string]int{
		"alice":   31,
		"charlie": 34,
	}
	fmt.Println(ages1)
	ages1["alice"] = 32
	ages1["bob"]++
	fmt.Println(ages1["alice"])
	delete(ages1, "alice")
	fmt.Println(ages1)
	for name, age := range ages1 {
		fmt.Printf("%s\t%d\n", name, age)
	}

	//var names []string
	names := make([]string, 0, len(ages1))
	for name := range ages1 {
		names = append(names, name)
	}
	sort.Strings(names)
	for _, name := range names {
		fmt.Printf("%s\t%d\n", name, ages1[name])
	}

	var ages2 map[string]int
	fmt.Println(ages2 == nil)
	fmt.Println(len(ages2) == 0, ages2["bob"])
	//ages2["bob"]++
	fmt.Println(len(ages2) == 0, ages2["bob"])

	type Employee struct {
		ID            int
		Name, Address string
		DoB           time.Time
		Position      string
		Salary        int
		ManagerID     int
	}
}
